package com.itheima.controller.sms;


import com.itheima.api.sms.SmsCouponHistoryService;
import com.itheima.vo.domain.AjaxResult;
import com.itheima.vo.domain.TableDataInfo;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/couponHistory")
public class SmsCouponHistoryController {

    @DubboReference
    private SmsCouponHistoryService smsCouponHistoryService;


    //根据优惠券id，使用状态，订单编号分页获取领取记录
    @GetMapping("list")
    public AjaxResult page(@RequestParam(value = "couponId", required = false) Long couponId,
                           @RequestParam(value = "useStatus", required = false) Long useStatus,
                           @RequestParam(value = "orderSn", required = false) String orderSn,
                           @RequestParam(value = "pageSize") Integer pageSize,
                           @RequestParam(value = "pageNum") Integer pageNum){
        TableDataInfo page = smsCouponHistoryService.page(couponId, pageNum, pageSize, useStatus, orderSn);

        return AjaxResult.success(page);
    }
}
